﻿using System;
using System.Collections.Generic;
using System.Text;

namespace designmodule.behavioralmodule.Mediator
{
    public abstract class Colleague
    {
        protected Mediator _mediator;

        protected Colleague(Mediator mediator)
        {
            _mediator = mediator;
        }
    }


    public class ConcreteColleague1 : Colleague
    {
        public ConcreteColleague1(Mediator mediator) : base(mediator)
        {
        }

        public void Send(string message)
        {

            _mediator.Send(message,this);
        }

        public void Notify(string message)
        {
            Console.WriteLine("得到消息");
        }
    }

    public class ConcreteColleague2 : Colleague
    {
        public ConcreteColleague2(Mediator mediator) : base(mediator)
        {
        }

        public void Send(string message)
        {

            _mediator.Send(message, this);
        }

        public void Notify(string message)
        {
            Console.WriteLine("得到消息");
        }
    }
}
